package com.xingxin.controller;


import com.xingxin.entity.Attribute;
import com.xingxin.service.AttributeService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 属性表 前端控制器
 * </p>
 *
 * @author mrLiu
 * @since 2021-01-08
 */
@RestController
@RequestMapping("/attribute")
public class    AttributeController {
    public static final Logger logger = LoggerFactory.getLogger(AttributeController.class);
    @Autowired
    private AttributeService attributeService;

    @GetMapping("/hello")
    public String hello(){
        logger.info("==>AttributeController--hello()--start");
        return "hello world!";
    }

    @GetMapping("/select")
    public List<Attribute> selectAll(){
        logger.info("==>AttributeController--selectAll()--start;params is:{}");
        List<Attribute> attributes = attributeService.selectAll();
        logger.info("==>AttributeController--selectAll()--over;result is:{}",attributes);
        return attributes;
    }
}

